import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    navList: [],
    maxWidth: "100%",
    fontSize: "16px",
    fontFamily: "Arial, Helvetica, sans-serif"
  },
  getters: {
  },
  mutations: {
    closeTab(state, arr) {
      state.navList = arr
    },
    addTab(state, route) {
      let arr = state.navList || []
      let text = route.meta.title
      let isHave = arr.some(item => item.text == text)
      if (isHave) {
        return false
      }
      arr.push({
        id: Symbol(),
        text: text,
        path: route.path
      })
      state.navList = arr
    },
    changeMaxWidth(state, value) {
      state.maxWidth = value
    },
    changeFontSize(state, value) {
      state.fontSize = value
    },
    changeFontFamily(state, value) {
      state.fontFamily = value
    }
  },
  actions: {
  },
  modules: {
  }
})
